FROM  ubuntu
MAINTAINER shida <qiushida@ctsi.com.cn>

RUN apt-get update

RUN apt-get install -y \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg |  apt-key add -

RUN add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

RUN apt-get update && apt-get install docker-ce -y


COPY ./sources.list /etc/apt/sources.list
#RUN cat /etc/apt/sources.list
# always run apt update when start and after add new source list, then clean up at end.
RUN  apt-get update -yqq \
&& apt-get install libltdl7 rsync git  openssh-server -yqq \
&& apt-get clean  \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*  \
&& /bin/echo -e "\nyes\n\nyes" | ssh-keygen -t rsa -C "InDocker" \
&& mkdir /var/run/sshd \
 # 设置root ssh远程登录密码为123456
&& echo "root:123456" | chpasswd

COPY authorized_keys /root/.ssh/authorized_keys
WORKDIR /var
EXPOSE 22
CMD    ["/usr/sbin/sshd", "-D"]
